<template>
  <div class="said">
    <div class="sum">
      <a-form
        :model="formState"
        name="basic"
        :label-col="{ span: 8 }"
        :wrapper-col="{ span: 16 }"
        autocomplete="off"
        @finish="onFinish"
        @finishFailed="onFinishFailed"
      >
        <a-form-item
          label="用户名"
          name="username"
          :rules="[{ required: true, message: 'Please input your username!' }]"
        >
          <a-input v-model:value="formState.username" />
        </a-form-item>

        <a-form-item
          label="密码"
          name="password"
          :rules="[{ required: true, message: 'Please input your password!' }]"
        >
          <a-input-password v-model:value="formState.password" />
        </a-form-item>

        <a-form-item name="remember" :wrapper-col="{ offset: 8, span: 16 }">
          <a-checkbox v-model:checked="formState.remember">记住密码</a-checkbox>
        </a-form-item>

        <a-form-item :wrapper-col="{ offset: 8, span: 16 }">
          <div class="submit">
            <a-button type="primary" html-type="submit" @click="toHome"
              >提交</a-button
            >
          </div>
        </a-form-item>
      </a-form>
    </div>
  </div>
</template>

<script setup>
import { reactive } from "vue";
import { useRouter } from "vue-router";
import { RouterLink } from "vue-router";
const router = useRouter();
const formState = reactive({
  username: "",
  password: "",
  remember: true,
});
const onFinish = (values) => {
  console.log("Success:", values);
};
const onFinishFailed = (errorInfo) => {
  console.log("Failed:", errorInfo);
};
function toHome() {
  router.push({ path: "/home" });
  // console.log(this.$refs.tbale);
}
</script>

<style lang="scss" scoped>
.said {
  // background: url("@/assets/total.png");
  width: 100%; //大小设置为100%
  height: 100%; //大小设置为100%
  position: fixed;
  background-size: 100% 100%;
  background-color: #f2f3f4;
}

.sum {
  margin-left: 500px;
  margin-top: 300px;
  color: #fff;
  width: 400px;
  height: 200px;
}
.sub {
  margin-left: 100px;
}
.submit {
  width: 70px;
  height: 30px;
  margin-left: 100px;
  color: #fff;
  cursor: pointer;
}
</style>
